<?php
	//include("admin_check.inc.php");
//	include("config.inc.php");
	include("dbconnect.inc.php");
	if($_GET["ok"] == "1") $message="操作成功";
	if($_GET["do"] == "1") {
		$category_name = mysql_real_escape_string($_POST["ncalss_name"]);
		$order_id =  $_POST["order_id"];
		$message = "";
		if($category_name == "") {
			$message .= "栏目名不能为空<br />";
		}
		if(!is_numeric($order_id)) {
			$message .= "排序号必须为数字<br />";
		}
		if($message == "") {
			$sql = "insert into new_class(nclass_name,order_id) values('{$nclass_name}',{$order_id}) ";
			if(mysql_query($sql)) {
				$message = "添加完成";
				$id = mysql_insert_id();
				header("Location:list.php?category={$id}");
			}else {
				$message = "添加失败，DB错误";
			}
		}
	}
?>
<?php 
//include("header.inc.php");
 ?>
<table width="778" border="0" cellpadding="0" cellspacing="6" class="border">
  <tr> 
    <td valign="top" width="100%" class="listcontent" align="center"> 
          <b><?Php echo $message; ?></b>
      <table width="100%" border="0" cellpadding="6" cellspacing="0">
        <tr> 
          <td class="listTitle"> 
            <table width="100%" border="0" cellspacing="0" cellpadding="0">
                <tr>
                  <td><strong>添加栏目</strong></td><td align=right>&nbsp;</td>
                </tr>
            </table>
          </td>
        </tr>
        <tr> 
          <td valign="top" class="list"> 
			<form action="admin_addcategory.php?do=1" method="post">
				栏目标题：<input type="text" name="category_name" size="50" /><br />
				排序数字：<input type="text" name="order_id" size="10" value="10"/><br />
				<input type="submit" value="添　　加" />
			</form>
          </td>
        </tr>
      </table>
    </td>
  </tr>
</table>
<?php include("footer.inc.php"); ?>